﻿package fpc.changers;

class FloatStringAdapter extends AChangerAdapter<Float, String>
{
	override function fromAdapted(value:Float, adaptedValue:String):Float
	{
		var newValue = Std.parseFloat(adaptedValue);
		if (Math.isNaN(newValue))
		{
			return value;
		}
		return newValue;
	}
	
	override function toAdapted(value:Float, adaptedValue:String):String
	{
		if (Math.isNaN(value))
		{
			return adaptedValue;
		}
		return Std.string(value);
	}
}